<style>
    .layui-form .layui-form-item .layui-inline .layui-form-label {
        width: 200px;
        font-size: 18px;
        font-weight: bold;
    }
    .layui-form .layui-form-item .layui-inline .layui-input-inline input{
        width: 800px;
        font-size: 16px;
    }
</style>
<form class="layui-form  seller-alone-form" id="userAction" style="padding:20px;height: 800px;">
    <fieldset class="layui-elem-field layui-field-title">
        <legend>
            <a href="{:url('usdtReturn')}" style="color: #428bca;font-weight:bold;" >Usdt 工单</a> / Action
        </legend>
    </fieldset>
    <br/>
    <br/>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">用户名：</label>
            <div class="layui-input-inline" style="width: 300px;">
                <input type="text" readonly value="{$username}" style="border: 0;color: red" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">实际付款金额：</label>
            <div class="layui-input-inline" style="width: 300px;">
                <input type="text" readonly value="{$list.amount}" style="border: 0;color: red" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">实际付款时间：</label>
            <div class="layui-input-inline" style="width: 300px;">
                <input type="text" readonly value="{$list.error_time}" style="border: 0;color: red" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">trx_hash：</label>
            <div class="layui-input-inline" style="width: 300px;">
                <input type="text" readonly value="{$list.trx_hash}" style="border: 0;color: red" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">错误充值记录：</label>
            <div class="layui-input-inline" style="width: 300px;">
                <input type="text" readonly value="订单号:{$fund_oy_list.out_trade_no} , 充值时间:{$fund_oy_list.ctime} , 充值金额:$ {$fund_oy_list.amount_real}" style="border: 0;color: red" class="layui-input">
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline" >
            <label class="layui-form-label">对应实付爬虫日志：</label>
            <div class="layui-input-inline" style="width: 800px;">
                <select name="ok_history" id="ok_history" lay-filter="ok_history"  lay-verType="tips" >
                    <option value="">选择已付款成功日志(如没有选项,则说明爬虫日志中没有对应的付款记录)</option>
                    {if !empty($list_array)}
                        {foreach $list_array as $v}
                        <option value="{$v.id}">{$v.ctime} , 付款金额:$ {$v.amount} , {$v.txid}</option>
                        {/foreach}
                    {/if}
                </select>
            </div>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">描述：</label>
            <div class="layui-input-inline" style="width: auto">
                    <textarea name="remark" id="remark" style="width: 600px;padding-left: 2px;"
                              placeholder="Input Failed" class="layui-textarea"></textarea>
            </div>
        </div>
    </div>
    <div class="layui-form-item" style="padding-top: 50px;">
        <div class="layui-input-block">
            <input type="hidden" name="return_id" id="return_id" value="{$return_id}">
            <button type="button" class="layui-btn" lay-submit lay-filter="save">确认充值</button>
            <button type="button" class="layui-btn" lay-submit lay-filter="save_error" style="color: black">充值失败</button>
            <a href="{:url('usdtReturn')}" class="layui-btn layui-btn-primary" >{:lang('返回')}</a>
        </div>
    </div>
    <div class="funaduibi fbai" style="padding-top: 50px;">
        <label style="font-size: 20px;width:550px;font-weight: bold">实付付款金额爬虫日志</label>
        <div class="fdbtable qmfdbtable ftable fboxbai" style="width: auto;">
            <table border="0" cellspacing="0" cellpadding="0" width="100%" id="dataTable">
            </table>
        </div>
    </div>
</form>

<script>
    layui.use(['form','table'], function () {
        var form = layui.form,
            table = layui.table; //表格

        const blog = "{$is_show}";
        if(!blog){
            layer.msg("{$error_msg}", {time:2000} ,function () {
                window.location.href = "{:url('usdtReturn')}";
            });
        }

        form.on('submit(save)', function(data){
            layer.confirm("您确定'确认充值么'?", {
                btn: ['确认', '取消'] //按钮
            }, function () {
                JsPost("{:url('usdtAction')}", data.field, function(res){
                    if (res.code > 0) {
                        layer.msg(res.msg, {time: 1500, icon: 1}, function () {
                            window.location.href = "{:url('usdtReturn')}";
                        });
                    } else {
                        layer.msg(res.msg, {time: 1500, icon: 2});
                    }
                });
            }, function () {
                layer.close(1);
            });
        });
        form.on('submit(save_error)', function(data){
            JsPost("{:url('usdtActionError')}",  data.field ,function(res){
                if (res.code > 0) {
                    layer.msg(res.msg, {time: 1500, icon: 1}, function () {
                        window.location.href = "{:url('usdtReturn')}";
                    });
                } else {
                    layer.msg(res.msg, {time: 1500, icon: 2});
                }
            });
        });
        table.render({
            elem: '#dataTable',
            height: 'auto',
            cellMinWidth: '80',
            totalRow: true,
            method: 'post',
            where:{'amount':"{$list.amount}"},
            url: "{:url('usdtAccept')}",
            id: 'dataTable',
            text:{none: '无数据'},
            cols: [[
                { type: 'numbers'},
                { field: 'ctime',  align: 'left', title: '创建时间',width:180},
                { field: 'utime',  align: 'left', title: '结束时间',width:180},
                { field: 'amount', title: 'amount', align:"right",
                    style:'color:#FF5722;font-weight:bold', totalRow: true,width:150},
                { align: 'left', title: '是否处理',width:90,
                    templet: function (d) {
                        const is_action=d.is_action;
                        return (is_action==1)?'<span style="color:green">已处理</span>':'<span style="color:red">未处理</span>';
                    }
                },
                { field: 'from',  align: 'left', title: 'from',width:180},
                { field: 'to',  align: 'left', title: 'to',width:180},
                { field: 'txid',  align: 'left', title: 'txid'}
            ]],
            page: true,
            limit: 10,
            limits: [10, 50, 100],
        });
    });
</script>
